package data;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;

public class DictionaryHolder {

	Map<String, Dictionary> hashes;

	public DictionaryHolder() {

		hashes = new TreeMap<String, Dictionary>();
	}
	
	public Dictionary getDictionary(String name) {
		
		return hashes.get(name);
	}
	
	public void putDictionary(Dictionary dict) {
		
		hashes.put(dict.getName(), dict);
	}

	public List<Dictionary> getAllDictionaries() {

		List<Dictionary> dictionaries = new ArrayList<Dictionary>();

		for (Entry<String, Dictionary> dict : hashes.entrySet()) {
			dictionaries.add(dict.getValue());
		}

		return dictionaries;

	}

}
